<template>
  <div>
    <div><el-tree
      ref="perTree"
      :data="permissionList"
      :props="{label:'name'}"
      show-checkbox
      default-expand-all
      check-strictly
      node-key="id"
      @node-click="handleNodeClick"
    /></div>

    <el-row class="footer" type="flex" justify="center">
      <el-col :span="6">
        <el-button size="small" @click="cancelButton">取 消</el-button>
        <el-button size="small" type="primary" @click="setRolesBtn">确 定</el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'AssignPermission',
  props: {
    permissionList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {

    }
  },
  created() {

  },
  methods: {
    // 取消按钮
    cancelButton() {
      this.$emit('update:permissionShowDialog', false)
    },

    // 确定设置权限按钮
    setRolesBtn() {
      const perIdArr = this.$refs.perTree.getCheckedKeys()
      this.$emit('setPerIdsEv', perIdArr)
      this.$emit('update:permissionShowDialog', false)
    },
    // 点击Tree 节点功能
    handleNodeClick() {

    }
  }
}
</script>

<style lang="scss" scoped>
.footer {
  margin-top: 30px;
}
</style>
